/**
 * WebHandler.js
 * @author Ulyan Sobin
 * @description WebHandler class
 */

"use strict";

const { WebNode } = require("./WebNode");
const { WebClient } = require("./WebClient");

/**
 * @callback ResolveFunction
 * @param { WebClient } client
 */

class WebHandler extends WebNode {

	/**
	 * Resolve function
	 * @type { ResolveFunction }
	 */
	resolve;

	/**
	 * Constructor of `WebHandler`
	 * @param { ResolveFunction } resolve 
	 */
	constructor (resolve) {
		super();
		this.resolve = resolve;
	}

	/**
	 * 
	 * @param { WebClient } client 
	 */
	route(client) {
		this.resolve(client);
	}
}

module.exports.WebHandler = WebHandler;